package cn.kgc.springboot.config;

import cn.kgc.springboot.interceptor.LoginInterceptor;
import cn.kgc.springboot.util.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author mosin
 * date 2021/12/16
 * @version 1.0
 */
// @Configuration
public class LoginConfiger  implements WebMvcConfigurer {
    @Autowired
    private LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        InterceptorRegistration registration = registry.addInterceptor(loginInterceptor);
        //配置拦截的路径和放行路径
        registration.addPathPatterns("/**");
        registration.excludePathPatterns("/user/tologin","/user/toregister","/user/login","/user/register","/*.css");
    }

}
